﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace TELOS_Konverter
{
    class FileOperations
    {
        #region VARIABLES

        public System.Text.Encoding ANSI = System.Text.Encoding.GetEncoding(1252);

        public Encoding getANSI() { return ANSI; }

        // simple media file name, without extension
        private static String mediaFileName;
        private string relativeFolder;
        public static string rootFolder;

        // RPM
        private static String rpmFileName;
        private static string rpmFileDir;
        private static string rpmFilePath;

        // SMI - Addresses
        private static String smiFileName;
        private static string smiFileDir;
        private static string smiFilePath;

        // SAMI / Caption
        private static String samiFileName;
        private static String samiWebFileDir;
        private static string samiWebFilePath;
        private static string samiWebCaptionFilePath;
        private static string samiLocalFileDir;
        private static string samiLocalFilePath;
        private static string samiLocalCaptionFilePath;
        
        // RM
        private static String rmFileName;
        private static String rmFileDir;
        private static String rmFilePath;
        private static String rmFileType;

        // RT
        private static String rmTextFileName;
        private static string rmTextFileDir;
        private static string rmTextFilePath;
        private static bool rtAvailable;

        // ASX
        private static String asxFileName;
        private static string asxFileDir;
        private static string asxFilePath;
        public static double asxStartTime;
        
        // Additional Information
        private static String copyright;
        private static String serverMediaFilePath;
        private static String serverMediaFileDir;
        private static string currentFolder;

        private static List<string> newHTMLFileContent;

        public const String RM_FILE_TYPE_AUDIO = "audio";
        public const String RM_FILE_TYPE_VIDEO = "video";
        private const String LF = "\n";

        private StringHandler sth = new StringHandler();
        private MessageHandler mh = new MessageHandler();
        private ErrorHandler eh = new ErrorHandler();

        #endregion

        #region READ / WRITE

        /// <summary>
        /// <para>This function accesses a file, reads its content and returns it as a String</para><br />
        /// <para>Returning the file content as string might be inconvenient</para>
        /// </summary>
        /// <param name="fName">file name to be read</param>
        /// <returns>file content, separated in lines</returns>
        public List<string> readFile(String fName)
        {
            try
            {
                List<string> list = new List<string>(File.ReadAllLines(fName, ANSI));
                //mh.alert("Read file: " + fName);
                return list;
            }
            catch (Exception e)
            {
                eh.createError(e);
                mh.alert("Error reading file:\n"+fName);
                return new List<string>{""};
            }
        }
        
        /// <summary>
        /// Write a file with content as list of strings
        /// </summary>
        /// <param name="fName">File Name</param>
        /// <param name="content">List of strings defining the content</param>
        /// <returns>True if writeFile succeeded, false otherwise</returns>
        public bool writeFile(String fName, List<string> content)
        {
            /*
            try
            {
                File.WriteAllLines(fName, content);
                return true;
            }
            catch (Exception e)
            {
                eh.createError(e, "Tried to write file: \""+fName+"\"");
                return false;
            }
            */

            return writeFile(fName, content, Encoding.UTF8);
        }

        public bool writeFile(String fName, List<string> content, Encoding enc)
        {
            try
            {
                File.WriteAllLines(fName, content, enc);
                return true;
            }
            catch (Exception e)
            {
                eh.createError(e, "Tried to write file: \"" + fName + "\"");
                return false;
            }
        }
                
        #endregion

        /// <summary>
        /// Assign file names for all files subordinate to one web site
        /// This includes:
        /// - RPM file
        /// - SMI file
        /// - RM file
        /// - RM text file (subtitles), if present
        /// - ASX file
        /// </summary>
        /// <param name="htmlFilePath">Path to the html file that has to be accessed</param>
        /// <returns></returns>
        public bool assignFileNames(String htmlFileName, FileInformation fi)
        {
            setCurrentFolder(htmlFileName);
            setRelativeFolder(htmlFileName);
            if (setMediaFileName(htmlFileName))
            {
                setRPMFile(htmlFileName);
                setSMIFile(getRPMFilePath());
                setSAMIFile();
                //--
                setSAMIWebFileDir(fi.getSAMIWebFileDir()); //"http://projects.ael.uni-tuebingen.de/stz/stz_modules/");
                setSAMIWebFilePath();
                setSAMILocalFileDir();
                setSAMILocalFilePath();
                //--
                setRMFile(getSMIFilePath());
                setRMTextFile(getSMIFilePath());
                setAsxFile(getSMIFilePath());

                setCopyright(fi.getCopyright()); //"©2009 Universität Tübingen");
                setServerMediaFileDir(fi.getMediaFileDir()); //"mms://u-003-stimms08.uni-tuebingen.de/ne/neskk06/");
                    
                setServerMediaFilePath();

                bool display = false;
                if (display)
                {
                    mh.alert("html File Name: " + htmlFileName + LF +
                             "Current Folder: " + getCurrentFolder() + LF +
                             "Relative Folder: " + getRelativeFolder() + LF +
                             "MediaFileName: " + getMediaFileName() + LF +
                             "RPM File Name: " + getRPMFileName() + LF +
                             "RPM File Dir: " + getRPMFileDir() + LF +
                             "RPM File Path: " + getRPMFilePath() + LF +
                             "SAMI File Name: " + getSAMIFileName() + LF +
                             "SAMI File Dir: " + getSAMILocalCaptionFileName() + LF +
                             "SAMILocalCaptionFilePath: " + getSAMILocalCaptionFilePath() + LF +
                             "SAMILocalFileDir: " + getSAMILocalFileDir() + LF +
                             "SAMILocalFilePath: " + getSAMILocalFilePath() + LF +
                             "SAMIWebCaptionFileName: " + getSAMIWebCaptionFileName() + LF +
                             "SAMIWebCaptionFilePath: " + getSAMIWebCaptionFilePath() + LF +
                             "SAMIWebFileDir: " + getSAMIWebFileDir() + LF +
                             "SAMIWebFilePath: " + getSAMIWebFilePath() + LF +
                             "ServerMediaFileDir: " + getServerMediaFileDir() + LF +
                             "ServerMediaFilePath: " + getServerMediaFilePath() + LF +
                             "SMIFileDir: " + getSMIFileDir() + LF +
                             "SMIFileName: " + getSMIFileName() + LF +
                             "SMIFilePath: " + getSMIFilePath() + LF +
                             "RMFileDir: " + getRMFileDir() + LF +
                             "RMFileName: " + getRMFileName() + LF +
                             "RMFilePath: " + getRMFilePath() + LF +
                             "RMFileType: " + getRMFileType() + LF +
                             "RMTextFileDir: " + getRMTextFileDir() + LF +
                             "RMTextFileName: " + getRMTextFileName() + LF +
                             "RMTextFilePath: " + getRMTextFilePath() + LF +
                             "RTAvailable: " + getRTAvailable().ToString() + LF +
                             "ASXFileDir: " + getASXFileDir() + LF +
                             "ASXFileName: " + getASXFileName() + LF +
                             "ASXFilePath: " + getASXFilePath() + LF +
                             "Copyright: " + getCopyright());
                }
                return true;
            }
            else
                return false;
        }

        #region File Name Setter


        /// <summary>
        /// The mediafile can defined in the html file, but not neccessarily
        /// </summary>
        /// <param name="htmlFilePath">Path to the html file</param>
        /// <returns>Return _true_ if the html file does contain a mediafile, false otherwise</returns>
        public bool setMediaFileName(String htmlFileName)
        {
            List<string> cache = readFile(htmlFileName);
            string file = "";
            // trigger for fpv files
            string trigger1 = "var mediafile=\"";

            // trigger for ilegefos
            string trigger2a = "<EMBED SRC=\"";
            string trigger2b = "CONTROLS=";

            for (int i = 0; i < cache.Count; i++)
            {
                if (cache[i].IndexOf(trigger1) >= 0)
                {
                    // rules to extract the rpm file name
                    file = cache[i];
                    file = sth.delete(file, "=\"", new List<string> { "include", "before" });
                    file = sth.delete(file, "\"", new List<string> { "include", "after" });
                }
                else if ((cache[i].IndexOf(trigger2a) >= 0) && (cache[i].IndexOf(trigger2b) >= 0))
                {
                    // rules to extract the rpm file name
                    file = cache[i];
                    file = sth.delete(file, "SRC=\"", new List<string> { "include", "before" });
                    file = sth.delete(file, "\" CONTROLS", new List<string> { "include", "after" });
                    file = sth.delete(file, ".rpm", new List<string> { "include", "after" });
                }
            }

            FileOperations.mediaFileName = file;
            if (file.Equals(""))
            {
                return false;
            }
            else
            {
                return true;
            }
        }


        /// <summary>f
        /// Takes a long path and extracts the relative folder without the (local) root
        /// </summary>
        /// <param name="longFolder">Long path to a folder</param>
        public void setRelativeFolder(string longFolder)
        {
            string cache = sth.delete(longFolder,rootFolder,new List<string>{ "include", "before" });
            cache = sth.delete(cache, "\\", new List<string> { "exclude", "after" });
            this.relativeFolder = cache;
        }

        #region RPM

        public void setRPMFile(string htmlFileName)
        {
            setRPMFileName(htmlFileName);
            setRPMFileDir();
            setRPMFilePath();
        }

        /// <summary>
        /// Read the html file and set the path to the RPM file that is defined therein
        /// The reading process depends upon the line "<EMBED SRC=\"'+mediafile+">
        /// FileOperations.rpmFileName includes the current folder.
        /// </summary>
        /// <param name="htmlFilePath">Path to the html file</param>
        private void setRPMFileName(String htmlFileName)
        {
            List<string> cache = readFile(htmlFileName);
            string file = "";
            string bla = "";
            // First of all, we have to get the random number that is attached to every RPM file
            for (int i = 0; i < cache.Count; i++)
            {
                // string till file name
                string trigger1 = "document.write('<EMBED SRC=\"'+mediafile+'";
                string trigger2 = "<EMBED SRC\"";
                string actualTrigger = "";

                // check which kind of file we have at hand
                if (cache[i].IndexOf(trigger1) >= 0)
                    actualTrigger = trigger1;
                else if (cache[i].ToLower().IndexOf(trigger2) >= 0)
                    actualTrigger = trigger2;
                
                // if there is a file name in there, it's gonna extracted now:
                if (!actualTrigger.Equals(""))
                {
                    file = cache[i];
                    file = sth.delete(file, actualTrigger, new List<string> { "include", "before" });
                    file = sth.delete(file, ".rpm", new List<string> { "exclude", "after" });
                    break;
                }
            }

            // Now we get the actual media file name and attach the rest

            // this needs to be done for non-stz modules, I think. I'm tired :-(
            if (!sth.isStringInString(file, ".rpm"))
                file = file + ".rpm";

            FileOperations.rpmFileName = getMediaFileName() + file;
        }

        /// <summary>
        /// rpm dir equals current folder
        /// </summary>
        private void setRPMFileDir()
        {
            FileOperations.rpmFileDir = getCurrentFolder();
        }

        /// <summary>
        /// RPM path consists of current folder + rpm file name
        /// </summary>
        private void setRPMFilePath()
        {
            FileOperations.rpmFilePath = currentFolder + getRPMFileName();
        }

        #endregion

        #region SMI

        /// <summary>
        /// Set the smi file parameters<br />
        /// - File Name<br />
        /// - File Dir<br />
        /// - File Path<br />
        /// </summary>
        /// <param name="rpmFilePath">rpm file path</param>
        public void setSMIFile(string rpmFilePath)
        {
            setSMIFileName(rpmFilePath);
            setSMIFileDir();
            setSMIFilePath();
        }

        /// <summary>
        /// Set the path to the SMI file to read mediafile addresses
        /// FileOperations.smiFileName includes the current folder
        /// </summary>
        /// <param name="rpmFileName">Path to the rpm file that contains mediafile addresses</param>
        private void setSMIFileName(String rpmFileName)
        {
            List<string> cache = readFile(rpmFileName);
            String line = cache[0];
            String file = "";
            for (int i = line.LastIndexOf("/") + 1; i < line.Length; i++)
                file = file + line[i];
            FileOperations.smiFileName = file;
        }

        /// <summary>
        /// smi dir equals current folder
        /// </summary>
        private void setSMIFileDir()
        {
            FileOperations.smiFileDir = getCurrentFolder();
        }

        /// <summary>
        /// smi path equals smi dir + smi file name
        /// </summary>
        private void setSMIFilePath()
        {
            FileOperations.smiFilePath = getSMIFileDir() + getSMIFileName();
        }

        #endregion

        #region SAMI / Caption

        /// <summary>
        /// Set the SAMI file parameters<br />
        /// - Name<br />
        /// - Dir<br />
        /// - Path
        /// </summary>
        /// <param name="samiFilePath"></param>
        public void setSAMIFile()
        {
            setSAMIFileName();
            // The following have to be set differently?
            //setSAMIFileDir();
            //setSAMIFilePath();
        }

        private void setSAMIFileName()
        {
            FileOperations.samiFileName = getRPMFileName().Replace(".rpm", "_caption.smi");
        }

        /// <summary>
        /// Set the path to the SAMI file on the Server<br />
        /// This is usually the root folder on the web server:<br />
        /// http://projects.ael.uni-tuebingen.de/stz/stz_modules/<br /*>
        /// </summary>
        /// <param name="rmDir">Path to the real media file</param>
        private void setSAMIWebFileDir(string webServerRootFolder)
        {
            FileOperations.samiWebFileDir = (webServerRootFolder + getRelativeFolder()).Replace("\\", "/"); //"http://projects.ael.uni-tuebingen.de/stz/stz_modules/"; //getCurrentFolder();
        }

        /// <summary>
        /// What is going on here?
        /// </summary>
        /// <param name="samiFilePath">Directory of the sami file</param>
        private void setSAMIWebFilePath()
        {
            //mh.alert(getSAMIWebFileDir() + LF + getRelativeFolder() + LF + getSAMIFileName());
            FileOperations.samiWebFilePath = (getSAMIWebFileDir() + /* getRelativeFolder() + */ getSAMIFileName()).Replace("\\", "/");
            //mh.alert("Relative Folder:\n"+getRelativeFolder());
        }

        private void setSAMILocalFileDir()
        {
            FileOperations.samiLocalFileDir = getCurrentFolder(); // +getRelativeFolder();
        }

        private void setSAMILocalFilePath()
        {
            FileOperations.samiLocalFilePath = getSAMILocalFileDir() /*+ getRelativeFolder()*/ + getSAMIFileName();
            //mh.alert("getsamilocalfiledir: " + getSAMILocalFileDir() + LF +
            //            "getrelativefolder: " + getRelativeFolder() + LF +
            //            "getsamifilename: " + getSAMIFileName());
        }

        #endregion

        #region RM

        public void setRMFile(string smiFileName)
        {
            setRMFileName(smiFileName);
            setRMFileDir();
            setRMFilePath();
            setRMFileType(smiFileName);
        }

        /// <summary>
        /// Set the path to the RM file
        /// FileOperations.rmFileName contains *only* the file name
        /// FileOperations.rmFileDir contains *only* the folder
        /// This will probably not work.
        /// </summary>
        /// <param name="smiFileName">smi file containing addresses</param>
        private void setRMFileName(String smiFileName)
        {
            //List<string> content = readFile(smiFileName);
            // NEW NEW NEW
            List<string> content = readFile(getSMIFilePath());
            String searchString = "src=\"";
            String file = "";
            String dir = "";
            String cache = "";
            for (int i = 0; i < content.Count; i++)
            {
                if (content[i].IndexOf(searchString) >= 0)
                {
                    file = sth.delete(content[i], searchString, new List<string> { "before", "include" });
                    dir = sth.delete(content[i], searchString, new List<string> { "before", "include" });
                    file = sth.delete(file, "\"", new List<string> { "after", "include" });
                    for (int x = file.LastIndexOf("/") + 1; x < file.Length; x++)
                        cache = cache + file[x];
                    file = cache;
                    break;
                }
            }
            FileOperations.rmFileName = file;

            // now get the dir!
            dir = sth.delete(dir, searchString, new List<string> { "before", "include" });
            dir = sth.delete(dir, "/" + file, new List<string> { "after", "include" });
            cache = "";
            for (int i = dir.LastIndexOf("/") + 1; i < dir.Length; i++)
                cache = cache + dir[i];
            FileOperations.rmFileDir = cache + "/";
        }

        /// <summary>
        /// Set the RM file dir
        /// </summary>
        private void setRMFileDir()
        {
            FileOperations.rmFileDir = getCurrentFolder();
        }

        /// <summary>
        /// Set the RM file path
        /// </summary>
        private void setRMFilePath()
        {
            FileOperations.rmFilePath = getCurrentFolder() + getRMFileName();
        }

        /// <summary>
        /// Set whether the real media file is either audio or video
        /// This is depending upon what tag is used in the smi file
        /// </summary>
        /// <param name="smiFileName">smi file containing addresses</param>
        private void setRMFileType(String smiFileName)
        {
            //List<string> content = readFile(smiFileName);

            // NEW NEW NEW
            List<string> content = readFile(getSMIFilePath());
            String searchStringVideo = "<video src=";
            String searchStringAudio = "<audio src=";

            for (int i = 0; i < content.Count; i++)
            {
                if (content[i].IndexOf(searchStringAudio) >= 0)
                {
                    FileOperations.rmFileType = RM_FILE_TYPE_AUDIO;
                    break;
                }
                else if (content[i].IndexOf(searchStringVideo) >= 0)
                {
                    FileOperations.rmFileType = RM_FILE_TYPE_VIDEO;
                    break;
                }
            }
        }

        #endregion

        #region RT

        public void setRMTextFile(string smiFileName)
        {
            setRTAvailable();
            if (rtAvailable)
            {
                setRMTextFileName(smiFileName);
                setRMTextFileDir();
                setRMTextFilePath();
            }
        }

        /// <summary>
        /// Set the path to the subtitle file (*.rt)<br />
        /// FileOperations.rmTextFileName contains *only* the file name<br />
        /// This may only work if rmAvailable == true !<br />
        /// </summary>
        /// <param name="smiFileName">smi file containing addresses</param>
        private void setRMTextFileName(String smiFileName)
        {
            //List<string> content = readFile(smiFileName);

            // NEW NEW NEW
            List<string> content = readFile(getSMIFilePath());
            String searchString = "<textstream src=\"";
            String file = "";
            for (int i = 0; i < content.Count; i++)
            {
                if (content[i].IndexOf(searchString) >= 0)
                {
                    file = sth.delete(content[i], searchString, new List<string> { "before", "include" });
                    file = sth.delete(file, "\"", new List<string> { "after", "include" });
                    break;
                }
            }
            FileOperations.rmTextFileName = file;
        }

        /// <summary>
        /// This may only work if rmAvailable == true !
        /// </summary>
        private void setRMTextFileDir()
        {
            FileOperations.rmTextFileDir = getCurrentFolder();
        }

        /// <summary>
        /// This may only work if rmAvailable == true !
        /// </summary>
        private void setRMTextFilePath()
        {
            FileOperations.rmTextFilePath = getCurrentFolder() + getRMTextFileName();
        }

        /// <summary>
        /// Check whether subtitles are available
        /// Writes to FileOperations.rtAvailable
        /// => True if subtitles available, false otherwise
        /// </summary>
        public void setRTAvailable()
        {
            FileOperations.rtAvailable = false;
            List<string> content = new List<string>(readFile(getSMIFilePath()));
            for (int i = 0; i < content.Count; i++)
            {
                if (sth.isStringInString(content[i], "textstream"))
                {
                    FileOperations.rtAvailable = true;
                    break;
                }
            }
        }

        #endregion

        #region ASX

        public void setAsxFile(string smiFileName)
        {
            setAsxFileName(smiFileName);
            setAsxFileDir();
            setAsxFilePath();
        }

        /// <summary>
        /// Set the asx file name, which means:
        /// Replace .smi with .asx in the file name
        /// </summary>
        /// <param name="smiFileName">smi file name</param>
        public void setAsxFileName(String smiFileName)
        {
            FileOperations.asxFileName = getSMIFileName().Replace(".smi", ".asx");
                //smiFileName.Replace(".smi", ".asx");
        }

        private void setAsxFileDir()
        {
            FileOperations.asxFileDir = getCurrentFolder();
        }

        private void setAsxFilePath()
        {
            FileOperations.asxFilePath = getASXFileDir() + getASXFileName();
        }

        #endregion

        #region Additional Information

        /// <summary>
        /// Set the copyright
        /// </summary>
        /// <param name="copyright">Copyright statement</param>
        public void setCopyright(String copyright)
        {
            FileOperations.copyright = copyright;
        }

        /// <summary>
        /// Set the server media file path
        /// This is usually always the same and is therefore statically defined above
        /// mms://u-003-stimms08.uni-tuebingen.de/ne/neskk06/stz/
        /// </summary>
        /// <param name="serverPath"></param>
        public void setServerMediaFilePath()
        {
            string cache = "";
            if (getRMFileType() == RM_FILE_TYPE_AUDIO)
                cache = ".wma";
            else if (getRMFileType() == RM_FILE_TYPE_VIDEO)
                cache = ".wmv";
            FileOperations.serverMediaFilePath = getServerMediaFileDir() + /*getRelativeFolder().Replace("\\", "/") +*/ getMediaFileName() + cache;
        }

        public void setServerMediaFileDir(string serverDir)
        {
            FileOperations.serverMediaFileDir = serverDir;
        }

        /// <summary>
        /// Set the current folder so it can later easily be accessed 
        /// </summary>
        /// <param name="currentFolder">current folder</param>
        private void setCurrentFolder(string currentFolder)
        {
            string cache = "";
            for (int i = 0; i < currentFolder.LastIndexOf("\\") + 1; i++)
            {
                cache = cache + currentFolder[i];
            }
            FileOperations.currentFolder = cache;
        }

        /// <summary>
        /// Writes the html content into FileOperations.newHTMLFileContent
        /// </summary>
        /// <param name="htmlContent">The new content, comes as list of strings</param>
        public void setNewHTMLFileContent(List<string> htmlContent)
        {
            FileOperations.newHTMLFileContent = htmlContent;
        }

        #endregion

        #endregion

        #region File Name Getter

        public String getMediaFileName() { return FileOperations.mediaFileName; }
        public string getRelativeFolder() { return this.relativeFolder; }

        // RPM
        public String getRPMFileName() { return FileOperations.rpmFileName; }
        public string getRPMFileDir() { return FileOperations.rpmFileDir; }
        public string getRPMFilePath() { return FileOperations.rpmFilePath; }

        // SMI / Addresses
        public String getSMIFileName() { return FileOperations.smiFileName; }
        public string getSMIFileDir() { return FileOperations.smiFileDir; }
        public string getSMIFilePath() { return FileOperations.smiFilePath; }

        // SAMI / Caption
        public String getSAMIFileName() { return FileOperations.samiFileName; }
        // WEB
        public String getSAMIWebFileDir() { return FileOperations.samiWebFileDir; }
        public string getSAMIWebFilePath() { return FileOperations.samiWebFilePath; }
        public String getSAMIWebCaptionFileName() 
        {   // The caption file name is the same as the .rt file name but with "_caption" at the end of the file name, and "smi" as file type
            return getSAMIFileName().Replace(".rt", "_caption.smi"); ;
        }
        public string getSAMIWebCaptionFilePath() { return getSAMIWebFilePath().Replace(".rt", "_caption.smi").Replace("\\", "/"); }
        // LOCAL
        public string getSAMILocalFileDir() { return FileOperations.samiLocalFileDir; }
        public string getSAMILocalFilePath() { return FileOperations.samiLocalFilePath; }
        public String getSAMILocalCaptionFileName()
        {   // The caption file name is the same as the .rt file name but with "_caption" at the end of the file name, and "smi" as file type
            return getSAMIFileName().Replace(".rt", "_caption.smi"); ;
        }
        public string getSAMILocalCaptionFilePath() { return FileOperations.samiLocalFilePath.Replace(".rt", "_caption.smi"); }

        // RM
        public String getRMFileName() { return FileOperations.rmFileName; }
        public String getRMFileDir() { return FileOperations.rmFileDir; }
        public string getRMFilePath() { return FileOperations.rmFilePath; }
        /// <summary>
        /// Return if the real media file is either video or audio
        /// </summary>
        /// <returns>Audio: RM_FILE_TYPE_AUDIO<br />
        ///          Video: RM_FILE_TYPE_VIDEO
        /// </returns>
        public String getRMFileType() { return FileOperations.rmFileType; }

        // RT
        public String getRMTextFileName() { return FileOperations.rmTextFileName; }
        public string getRMTextFileDir() { return FileOperations.rmTextFileDir; }
        public string getRMTextFilePath() { return FileOperations.rmTextFilePath; }
        public bool getRTAvailable() { return FileOperations.rtAvailable; }

        // ASX
        public String getASXFileName() { return FileOperations.asxFileName; }
        public string getASXFileDir() { return FileOperations.asxFileDir; }
        public string getASXFilePath() { return FileOperations.asxFilePath; }

        // Miscellaneous
        public String getCopyright() { return FileOperations.copyright; }
        public String getServerMediaFilePath() { return FileOperations.serverMediaFilePath; }
        public String getServerMediaFileDir() { return FileOperations.serverMediaFileDir; }
        public List<string> getNewHTMLFileContent() { return FileOperations.newHTMLFileContent; }
        public string getCurrentFolder() { return FileOperations.currentFolder; }

        // Helper
        public String getFileFromPath(String path)
        {
            string cache = "";
            for (int i = path.LastIndexOf("\\") + 1; i < path.Length; i++)
            {
                cache = cache + path[i];
            }
            return cache;
        }

        public string getDirFromPath(string path)
        {
            return "";
        }
        #endregion
    }
}
